<!-- 客服 -->
<template>
	<view>
		<!-- 头部 -->
		<pagehead :pagesPath="pagesPath">{{ title }}</pagehead>
		<!-- #ifdef MP-WEIXIN -->
		<web-view :webview-styles="webviewStyles"
		:src="baseUrl"
		@message="getMessage">
		</web-view>
    <!-- #endif -->
    <!-- #ifdef APP-PLUS-->
    <iframe :src="baseUrl" frameborder="0"></iframe>
    <!-- #endif -->
	</view>
</template>
<script>
	export default {
		data() {
			return {
				baseUrl: '',
				webviewStyles: {
                    progress: {
                        color: '#141414',
                        Zindex:'1',
                    },
                    height:'50%'
                },
				typeNum: '',
				pagesPath: '/pages/order/order',
        title:'',
				plus:{
					android:{
						supportMultipleWindows :true,
						setSupportMultipleWindows:true,
					}
				},
			};
		},
		onBackPress(options) {
			console.log('from:' + options.from)
			const that = this
			uni.navigateTo({
				url: that.pagesPath,
				animationType:"none"         //加上，完美解决底部留白
			})
		},
		// 小程序的
		onHide(){
			console.log('离开:' )
			const that = this
			uni.navigateTo({
				url: that.pagesPath,
				animationType:"none"         //加上，完美解决底部留白
			})
		},
		onLoad(options) {
      console.log('options:' , options)
      // #ifdef MP-WEIXIN
			this.baseUrl = options.value1;
      console.log('baseUrl:' , this.baseUrl)
      // #endif
      // #ifdef APP-PLUS
      //  let url=options.value1+'?'+options.signNo+'&='
       let url=options.value1+'?'+options.signNo+'&='

      let arr={
          "value1": "https://h6.junziqian.com/signInfo/viewDetail?ts=1720685999134",
          "signNo": "SSN1811314478911385600",
          "sign": "GrOKcynkRAExJkp8Z5HMAThyy9jq-PiMDj_b5CmJSzU",
          "backUrl": "https://wxapp.jtkpay.com//#/pages/bank/bank"
      }
      Object.keys(arr).forEach(item,index){

      }
      console.log('url:' , url)
      this.baseUrl = url;
       // #endif
			this.typeNum = options.value2;
			this.pagesPath = options.value3;
		},
		onShow() {
			uni.hideLoading();
		},
		methods:{
			goBack(){
				if(this.typeNum == 1){
					this.$tools.redirectTo('/pages/order/order');
				}else{
					this.$tools.back(1);
				}
			},
      onMessage(e) {
        if (e.detail.data === 'back') {
          console.log('返回')
          this.$tools.redirectTo(this.pagesPath);
        }
      },
			// 用于 外部 H5 给 uniapp 传送函数
			getMessage(){
				
			}
		},
	}
</script>

<style lang="scss" scoped>
	page{
		background: #fff;
		width: 100vw;
	}
	.web-view,iframe{
    width: 100vw;
		height: calc(100vh - 88rpx - 40px);
	}
  .webvi{
    position: absolute;
    top: 88rpx;
  }
</style>
